package cn.xuchunh.campusbbs.adapter;

import android.content.Context;
import android.net.Uri;
import android.support.v4.view.ViewCompat;
import android.view.ViewGroup;

import cn.xuchunh.campusbbs.R;
import cn.xuchunh.campusbbs.base.BaseRecyclerViewAdapter;
import cn.xuchunh.campusbbs.bean.Picture;
import cn.xuchunh.campusbbs.viewholder.PhotoViewHolder;

/**
 * Created by XuChunH on 2015/10/23.
 */
public class PhotoListAdapter extends BaseRecyclerViewAdapter<PhotoViewHolder, Picture> {
    public PhotoListAdapter(Context context) {
        super(context);
    }

    @Override
    public PhotoViewHolder onCreateContentViewHolder(ViewGroup parent, int viewType) {
        return new PhotoViewHolder(inflater.inflate(R.layout.item_photo_list, parent, false), parent);
    }

    @Override
    protected void onBindContentViewHolder(PhotoViewHolder holder, int position) {

        Picture picture = getItem(position);

        Uri uri = Uri.parse(picture.getThumb());
        holder.bindContent(uri, picture.getTitle());

        ViewCompat.setTransitionName(holder.icon, position + "_image");

    }
}
